<?php

use console\db\Migration;
use yii\db\Expression;

/**
 * 圈子点赞统计信息更新
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m300020_000012_t_sns_dynamic_stats_views extends Migration {

    /**
     * @inheritdoc
     */
    public $tableName = '{{%sns_dynamic_stats}}';

    /**
     * @inheritdoc
     */
    public function safeUp() {
        $this->update($this->tableName, [
            'views' => new Expression('CEIL((likes+comments)*2+RAND()*100)'),
        ]);
    }

}
